const path = require('path');
const HtmlWebpackPlugin=require('html-webpack-plugin');
const webpack=require('webpack');
module.exports = {
    entry: './src/index.js',
    output: {
      filename: 'bundle.js'
    },
    plugins:[
        new HtmlWebpackPlugin({
            title:'homework',
            template:'./public/index.html',
            filename:'index.html',
        }),
        new webpack.HotModuleReplacementPlugin()   
    ],
    module: {
      rules: [
        {
          test: /\.css$/,
          use: [ 'style-loader', 'css-loader' ]
        },
        {
          test: /\.jsx?$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
                presets: ['@babel/preset-env']
            }
          }
        },
      ]
    },
    devServer:{
        port:3000,
        open:true,
        hot:true
    }
  };